package org.jeecg.modules.reports.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.reports.entity.LwgyWaterBuilding;
import org.jeecg.modules.reports.entity.LwgyWaterCampus;
import org.jeecg.modules.reports.entity.LwgyWaterLayer;
import org.jeecg.modules.reports.entity.LwgyWaterReport;
import org.jeecg.modules.reports.service.LwgyWaterReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * TODO
 *
 *
 */
@Api(tags="水量统计")
@RestController
@RequestMapping("/reports/lwgyWaterReport")
@Slf4j
public class LwgyWaterReportController extends JeecgController<LwgyWaterReport, LwgyWaterReportService> {

    @Autowired
    private LwgyWaterReportService lwgyWaterReportService;


    /**
     * 校区水量统计(日、周、月)
     * @author szw
     * */
    @PostMapping("/campusReport")
    public Result<?>campusReport(@RequestBody LwgyWaterCampus lwgyWaterCampus){
        List<LwgyWaterCampus> reportList = lwgyWaterReportService.campusReport(lwgyWaterCampus);
//        List<Map<String,Integer>> campusList = new ArrayList<>(5);
        return Result.OK(reportList);
    }

    @PostMapping("/campusReportList")
    public Result<?>campusReportList(@RequestBody LwgyWaterCampus lwgyWaterCampus){
        List<LwgyWaterCampus> reportList = lwgyWaterReportService.campusReport(lwgyWaterCampus);
        IPage<LwgyWaterCampus>reportIPage = new Page<>(0,100);
        reportIPage.setRecords(reportList);
        return Result.OK(reportIPage);
    }


    /**
     * 楼宇水量统计(日、周、月)
     * @author szw
     * */
    @PostMapping("/buildingReport")
    public Result<?>buildingReport(@RequestBody LwgyWaterBuilding lwgyWaterBuilding){
        List<LwgyWaterBuilding> reportList = lwgyWaterReportService.buildingReport(lwgyWaterBuilding);
//        List<Map<String,Integer>> campusList = new ArrayList<>(5);
        return Result.OK(reportList);
    }

    @PostMapping("/buildingReportList")
    public Result<?>buildingReportList(@RequestBody LwgyWaterBuilding lwgyWaterBuilding){
        List<LwgyWaterBuilding> reportList = lwgyWaterReportService.buildingReport(lwgyWaterBuilding);
        IPage<LwgyWaterBuilding>reportIPage = new Page<>(0,100);
        reportIPage.setRecords(reportList);
        return Result.OK(reportIPage);
    }

    /**
     * 楼层水量统计(日、周、月)
     * @author szw
     * */
    @PostMapping("/layerReport")
    public Result<?>layerReport(@RequestBody LwgyWaterLayer lwgyWaterLayer){
        List<LwgyWaterLayer> reportList = lwgyWaterReportService.layerReport(lwgyWaterLayer);
//        List<Map<String,Integer>> campusList = new ArrayList<>(5);
        return Result.OK(reportList);
    }

    @PostMapping("/layerReportList")
    public Result<?>layerReportList(@RequestBody LwgyWaterLayer lwgyWaterLayer){
        List<LwgyWaterLayer> reportList = lwgyWaterReportService.layerReport(lwgyWaterLayer);
        IPage<LwgyWaterLayer>reportIPage = new Page<>(0,100);
        reportIPage.setRecords(reportList);
        return Result.OK(reportIPage);
    }


}
